(function ($, window, document, undefined) {

$(document).ready(function() {
	
	// Set your preferneces here:
	var logObjects = true;
	
	$klass = $.klass;
	$proto = $klass.prototype;
	$trait = $.trait;
	Trait = $klass.Trait;
	
	module("Traits");
	
	test("Basic tests", function() {
	
		var methods = {
				Named: {
					getName: function() {
						return this.name + "." + arguments.callee._klass.name;
					}
				}
			};
		
		Named = $trait(methods.Named, methods.Named, $.extend({extended: function() { return true; }}, methods.Named));
		Named2 = $trait(Named, {named2: function() { return true; }});
		Unaffected = $trait({});
		
		logObjects && console.log(Named, Named.functions, Named.functions.constructor);
		
		strictEqual(Named.functions.getName, methods.Named.getName, 'Named.functions.getName');
		
		return;	// Because the following is for unimplemented ideas (complex traits)
		
		A = $.klass({
			init: function( show ) {
				if(show) console.log("A");
				this.name = "Name";
			},
			_traits: [Named, Named, Named2]
		});
		
		console.startRecordingLogs(false);
		a = new A( true );	// Will print "A" in the console
		strictEqual(console.stopRecordingLogs().join("\n"), "A", 'a = new A( true )');
		
		logObjects && console.log(a);
		
		strictEqual(a.name, "Name", 'a.name');
		strictEqual(a.getName._klass.traitFn, methods.Named.getName, 'Original function of a.getName');
		strictEqual(a.extended(), true, 'a.extended');
		strictEqual(a.named2(), true, 'a.named2');
		
		strictEqual(a.getName(), "Name.getName", 'a.getName()');
		
		strictEqual(a._hasTrait( Named ), A, 'a._hasTrait( Named )');
		strictEqual(a._hasTrait( Unaffected ), undefined, 'a._hasTrait( Unaffected )');
	});
});

})(jQuery, window, window.document);